package com.zham.springcloud;

import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.stereotype.Component;

@Component
public class MyHealthIndicator implements HealthIndicator {
	@Override
	public Health health() {
		int errorCode = check();
		if(errorCode != 0) {
			return Health.down().withDetail("Error Code", errorCode).build();
			
		}
		return Health.up().withDetail("MyHealth", "UP").build();
	}
	
	private int check() {
		//对监控对象的检测操作
		return 0;
	}
}
